<template>
  <div class="app-container" style="text-align: center">
    <el-tabs v-model="activeName">
      <el-tab-pane label="提现配置" name="withdrawal">
        <el-input placeholder="请输入提现最低金额" type="number" v-model="form.billAmount">
          <template slot="prepend">提现最低金额</template>
          <template slot="append">元</template>
        </el-input>
        <br />
        <el-input placeholder="请输入提现手续费" type="number" v-model="form.serviceCharge">
          <template slot="prepend">提现手续费</template>
          <template slot="append">列如：0.05</template>
        </el-input>

        <el-input v-model="form.carryRebate" type="number" placeholder="请输入提现返利">
          <template slot="prepend">提现返利</template>
          <template slot="append">列如：0.05</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="采购配置" name="purchase">
        <el-input v-model="form.purchasingRebate" type="number" placeholder="请输入采购返利">
          <template slot="prepend">采购返利</template>
          <template slot="append">列如：0.05</template>
        </el-input>
        <el-input v-model="form.workSubsidy" type="number" placeholder="请输入办公补贴">
          <template slot="prepend">办公补贴</template>
          <template slot="append">列如：0.05</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="交易金配置" name="trading">
        <el-input v-model="form.userDeal" type="number" placeholder="用户消费金额配置">
          <template slot="prepend">交易金序列号发放条件</template>
          <template slot="append">元/用户累计交易金额</template>
        </el-input>
        <el-input v-model="form.platformDeal" type="number" placeholder="请输入发放交易金">
          <template slot="prepend">序列号转换交易金条件</template>
          <template slot="append">元/平台累计交易金额</template>
        </el-input>
        <el-input v-model="form.dealGold" type="number" placeholder="请输入交易金（金币）">
          <template slot="prepend">发放交易金数量</template>
          <template slot="append">个</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="奖励金配置" name="reward">
        <el-input v-model="form.userAward" type="number" placeholder="请输入发放奖励金序列号">
          <template slot="prepend">奖励金序列号发放条件</template>
          <template slot="append">元/用户累计交易金额</template>
        </el-input>
        <el-input v-model="form.platformAward" type="number" placeholder="请输入发放奖励金">
          <template slot="prepend">序列号转换奖励金条件</template>
          <template slot="append">元/平台累计交易金额</template>
        </el-input>
<!--        <el-input v-model="form.platformAwardHasSend" type="number" placeholder="请输入发放奖励金（已发放额度）">-->
<!--          <template slot="prepend">发放奖励金（已发放额度）</template>-->
<!--        </el-input>-->
        <el-input v-model="form.awardGold" type="number" placeholder="请输入奖励金（金币）">
          <template slot="prepend">发放奖励金数量</template>
          <template slot="append">个</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="金币配置" name="gold">
        <el-input v-model="form.goldTime" placeholder="请输入金币转换现金时间">
          <template slot="prepend">金币转换现金时间</template>
          <template slot="append">分钟</template>
        </el-input>
        <el-input v-model="form.goldRatio" type="number" placeholder="请输入金币转换现金比例" v-if="false">
          <template slot="prepend">金币转换现金比例</template>
          <template slot="append">列如：0.05</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="分润" name="profit">
        <el-input v-model="form.distributionAmount" type="number" placeholder="金额">
          <template slot="prepend">扫码大于</template>
          <template slot="append">扫码小于</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="会员配置" name="vip">
        <el-input v-model="form.hundredThan" type="number" placeholder="请输入司令部百分百比">
          <template slot="prepend">司令部百分百比</template>
          <template slot="append">列如：0.05</template>
        </el-input>
<!--        <el-input v-model="form.hundredThanNumber" type="number" placeholder="请输入司令部百分百比基数">
          <template slot="prepend">司令部百分百比基数</template>
        </el-input>-->
      </el-tab-pane>
      <el-tab-pane label="订单配置" name="order">
        <el-input v-model="form.waitCancelTime" placeholder="请输入超时未支付订单取消时间">
          <template slot="prepend">超时未支付订单取消时间</template>
          <template slot="append">分</template>
        </el-input>
        <el-input v-model="form.waitConfirmTime" placeholder="请输入超时未收货订单自动确认时间">
          <template slot="prepend">超时未收货订单自动确认时间</template>
          <template slot="append">天</template>
        </el-input>
      </el-tab-pane>
      <el-tab-pane label="支付通知内容" name="notice">
        <el-input v-model="form.withdrawFailResult" placeholder="请输入提现失败通知内容">
          <template slot="prepend">提现失败通知内容</template>
        </el-input>
      </el-tab-pane>
    </el-tabs>
    <el-button type="primary" @click="submitForm">确 定</el-button>
  </div>
</template>

<script>
  import {
    listTRebateSetInfo,
    getTRebateSetInfo,
    delTRebateSetInfo,
    addTRebateSetInfo,
    updateTRebateSetInfo,
    exportTRebateSetInfo
  } from "@/api/pos/TRebateSetInfo";

  export default {
    name: "TRebateSetInfo",
    data() {
      return {
        // 表单参数
        form: {},
        activeName: 'withdrawal', //tabs标签页
      };
    },
    created() {
      this.handleUpdate(1);
    },
    methods: {
      /** 修改按钮操作 */
      handleUpdate(id) {
        getTRebateSetInfo(id).then(response => {
          this.form = response.data;
          console.log(this.form)
        });
      },
      /** 提交按钮 */
      submitForm() {
        if (this.form.id != null) {
          updateTRebateSetInfo(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
          });
        } else {
          addTRebateSetInfo(this.form).then(response => {
            this.$modal.msgSuccess("新增成功");
          });
        }
      },
    }
  };
</script>
<style>
  .el-tab-pane .el-input {
    margin-bottom: 10px;
    margin-left: 10px;
    width: 50%;
  }
</style>
